#!/bin/bash
fn_get_cpu_info()
{
 echo -e " CPU 型号名称"`cat /proc/cpuinfo | grep name | cut -f2 | uniq`
 echo -e " CPU 物理核数: "`grep -c 'model name' /proc/cpuinfo`
 echo -e " CPU 逻辑核数: "`cat /proc/cpuinfo | grep processor | wc -l`
 #echo `cat /proc/cpuinfo | grep 'model name' | sed 's'`
}

 fn_get_mem_info()
 {
  MemTotal=`free -m | grep Mem | awk '{print  $2}'`
  echo -e "     内存大小:"`cat /proc/meminfo | grep MemTotal | cut -f2 -d: | uniq`
 }


fn_get_disk_info()
{
 echo -e "     磁盘信息: " 
 df -Th | awk '{print "              "$0}'
#for x in `df -Th | grep | awk '{print $1 "-" $2 "-" $3 "-" $4 "-" $5 }' | sed 's/%//g'`
 #do
  #disk_status=(${x//"-"/" "})
 # echo "${disk_status[1]} ${disk_status[2]} ${disk_status[3]} ${disk_status[4]} ${disk_status[5]} }"
# done 
}

fn_get_net_info()
{
echo -e "     网卡型号: "`lspci | grep -i eth`
echo -e "     Raid版本: "`lspci | grep -i raid`
echo -e "     显卡信息: "`lspci | grep -i vga`
}

fn_get_soft_info()
{
echo -e "     操作系统版本: "`cat /etc/issue |grep \\\l | sed 's/\\\l//g' | grep \\\n | sed 's/\\\n//g'`
echo -e "     内核版本："`cat /proc/version`
echo -e "     Binutils版本: "`ld -v`
echo -e "     Glibc版本: "`rpm -q glibc  ldd --version`
echo -e "     Glib版本: "`rpm -q glib`
echo -e "     GCC版本："`gcc --version`
echo -e "     C库版本："`rpm -q glib`
echo -e "     C++版本："`g++ --version`
echo -e "     QT版本: "`qmake -v`
echo -e "     Shell版本: "`bash --version`
echo -e "     Java版本: "`java --version`
echo -e "     Python版本: "
python --version
}
echo -e "\n -----------This Computer's Config Information is: -----------\n"
fn_get_cpu_info
fn_get_mem_info
fn_get_disk_info
fn_get_net_info
fn_get_soft_info
echo -e "\n -----------------------------End ----------------------------\n"
